﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ExamSystem.Mdeol;
using ExamSystem.BLL;
namespace ExamSystem.ht
{
    public partial class TClass_Add : System.Web.UI.Page
    {
        private TclassBLL tb = new TclassBLL();
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void Button1_Click(object sender, EventArgs e)
        {
               //获取数据
                string tcno = this.tcNo.Value;
                //验证
                if(string.IsNullOrEmpty(tcno))
                {
                    util.FunHelper.LayerAlter(this,"班级名称不能为空");
                }
                int i= tb.selecttcno(tcno);
                if (i > 0)
                {
                    util.FunHelper.LayerAlter(this, "班级名重复");
                }
                else
                {
                    int b = tb.inserttclass(tcno);
                    if (b > 0)
                    {
                        util.FunHelper.LayerAlter(this, "添加成功", "TClass_List.aspx");
                    }
                    else
                    {
                        util.FunHelper.LayerAlter(this, "添加失败");
                    }
                }
           
        }
        protected void onclick(object sender, EventArgs e)
        {
            util.FunHelper.LayerAlter(this, "确定返回吗？", "TClass_List.aspx");
        }
    }
}